package cn.com.yusys.yusp.mobile.web.rest;

import cn.com.yusys.yusp.commons.mapper.QueryModel;
import cn.com.yusys.yusp.commons.web.rest.dto.ResultDto;
import cn.com.yusys.yusp.mobile.service.HomePageTaskService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping({"/mobile/homePageTask","/api/homePageTask"})
public class HomePageTaskResource {

    @Resource
    private HomePageTaskService homePageTaskService;

    /**
     * 通过userId查询
     *
     * @param
     * @return
     */

    @GetMapping("/getTaskOverview")
    public ResultDto<Object> getTaskOverview(QueryModel queryModel) {
        return new ResultDto<>(homePageTaskService.getTaskOverview(queryModel));
    }

    @GetMapping("/getTaskDetailsNum")
    public ResultDto<Object> getTaskDetailsNum(QueryModel queryModel) {
        return new ResultDto<>(homePageTaskService.getTaskDetailsNum(queryModel));
    }

    @GetMapping("/getTaskInformation")
    public ResultDto<Object> getTaskInformation(QueryModel queryModel) {
        return new ResultDto<>(homePageTaskService.getTaskInformation(queryModel));
    }

    @GetMapping("/getTaskDetails")
    public ResultDto<Object> getTaskDetails(QueryModel queryModel) {
        return new ResultDto<>(homePageTaskService.getTaskDetails(queryModel));
    }

    @PostMapping("/updateTaskRemind")
    public ResultDto<Integer> updateTaskRemind(@RequestBody Map map) {
        String readFlg =map.get("readFlg").toString();
        if (readFlg.equals("0")){
        return new ResultDto<>(homePageTaskService.updateTaskRemind(map));
        }
        else {
            return new ResultDto<>(null);
        }
    }

    @PostMapping("/updateImportantCustomer")
    public ResultDto<Integer> updateImportantCustomer(@RequestBody Map map) {
        return new ResultDto<>(homePageTaskService.updateImportantCustomer(map));
    }


}